<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
	function relateTicketConfirm() {
		var checks = $("#relation-ticket-table").find("input[name='ticketId']:checked");
		if(checks.size()==0)
			alert("请选择关联的票！！");
		else {
			var checkIdStr = checks.map(function() {
				return $(this).val();
			}).get().join(",");
			$.ajax({
				url:"/ticket/bindRelateTickets.htm",
				type:"post",
				data:{
					ticketIdStr:checkIdStr,
					ticketId:ticketId
				},
				dataType:"json"
			}).done(function(data){
				alert(data.msg);
				if(data.isSuccess) {
					$(".ticket-index-div").hide();
					$(".ticket-index-div:eq(2)").show();
					$("#relation-index-ticket-table").load("/ticket/ticketRelations.htm?id="+ticketId);
				}
			})
		}
	}
	
	function relateTicketReturn() {
		$(".ticket-index-div").hide();
		$(".ticket-index-div:eq(2)").show();
	}
</script>
<div class="ch-container">
	<div class="row">
		<div class="box col-md-12">
	        <div class="box-inner">
	            <div class="box-header well" data-original-title="">
	                <h2><i class="glyphicon glyphicon-edit"></i> 查询条件</h2>
	
	                <div class="box-icon">
	                    <a href="javascript:;" class="btn btn-setting btn-round btn-default"><i
	                            class="glyphicon glyphicon-cog"></i></a>
	                    <a href="javascript:;" class="btn btn-minimize btn-round btn-default"><i
	                            class="glyphicon glyphicon-chevron-up"></i></a>
	                    <a href="javascript:;" class="btn btn-close btn-round btn-default"><i
	                            class="glyphicon glyphicon-remove"></i></a>
	                </div>
	            </div>
	            <div class="box-content">
	                <form class="form-inline">
	                    <div class="form-group col-md-4">
	                        <label>产品名称：</label>
	                        <input id="name" type="text" class="form-control">
	                    </div>
	                    <div class="form-group col-md-4">
	                        <label>所属景区/项目：</label>
	                        <input id="name" type="text" class="form-control">
	                        <a href="javascript:;" class="btn btn-default" onclick="selectScene();">选择</a>
	                    </div>
	                    <div class="clearfix"></div><br>
	                    <div class="form-group col-md-6">
	                        <label>有效时间：</label>
	                        <input name="open_time" type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="form-control"/>
	                        <label> - </label>
	                        <input name="open_time" type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="form-control"/>
	                    </div>
	                    <div class="form-group col-md-3">
	                    	<a href="javascript:;" class="btn btn-default" onclick="query();">查询</a>
	                    </div>
	                    <div class="clearfix"></div><br>
	                </form>
	            </div>
	        </div>
	    </div>
	    <!--/span-->
		</div>
		<div class="row">
			<div class="box col-md-12">
    			<div class="box-inner">
    				<div class="box-header well" data-original-title="">
        				<h2><i class="glyphicon glyphicon-user"></i> 票品列表</h2>

        				<div class="box-icon">
				            <a href="#" class="btn btn-setting btn-round btn-default"><i class="glyphicon glyphicon-cog"></i></a>
				            <a href="#" class="btn btn-minimize btn-round btn-default"><i
				                    class="glyphicon glyphicon-chevron-up"></i></a>
				            <a href="#" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
				        </div>
    				</div>
    				<div class="box-content" id="relation-ticket-table">
				    </div>
    			</div>
    		</div>
    <!--/span-->
		</div>
		<a href="javascript:;" class="btn btn-default" onclick="relateTicketConfirm();">确定</a>
		<a href="javascript:;" class="btn btn-default" onclick="relateTicketReturn();">返回</a>
	</div>
